home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / bcsrce2.zip / CHEKBOX4.BC < prev    next >
Text File  |  1990-11-01  |  3KB  |  124 lines

  1. let %!a = %1
  2. if %!a# = # goto ERROR
  3. let %!z = %!a
  4. gt %!z 21
  5. if errorlevel 1 goto ERROR
  6. if %!a = 0 Let %!a = 10
  7. goto TEST1
  8. :TEST1
  9. let %!b = %2
  10. if %!b# = # goto ERROR
  11. let %!z = %!b
  12. gt %!z 65
  13. if errorlevel 1 goto ERROR
  14. if %!b = 0 Let %!b = 30
  15. let %!p = %3
  16. if %!p# = # let %!p = y
  17. lower %!p
  18. if %!p = yes let %!p = y
  19. if %!p = y let %!e = 1
  20. if %!p = no let %!p = n
  21. if %!p = n let %!e = 1
  22. if not %!e@ = 1@ goto ERROR
  23. if %!p = y GOSUB YES
  24. if %!p = n GOSUB NO
  25. goto CHOOSE
  26. :YES
  27. locate %!a %!b
  28. echonolf ╔═════╗   ┌─────┐
  29. let %!s = %!a
  30. add %!s 1
  31. locate %!s %!b
  32. echonolf ║ Yes ║   │ No! │
  33. add %!s 1
  34. locate %!s %!b
  35. echonolf ╚═════╝   └─────┘
  36. add %!s 1
  37. locate %!s 1
  38. return
  39. :NO
  40. locate %!a %!b
  41. echonolf ┌─────┐   ╔═════╗
  42. let %!s = %!a
  43. add %!s 1
  44. locate %!s %!b
  45. echonolf │ Yes │   ║ No! ║
  46. add %!s 1
  47. locate %!s %!b
  48. echonolf └─────┘   ╚═════╝
  49. add %!s 1
  50. locate %!s 1
  51. return
  52. :CHOOSE
  53. rem 3840=Shift tab, 121=y, 110=n, 89=Y, 78=N, 27=Esc, 13=Enter, 9=Tab
  54. rem Left arrow=19200, Right arrow=19712
  55. getkey
  56. if errlevel 19712 GOTO ARROW
  57. if errlevel 19200 GOTO ARROW
  58. if errlevel 3840 GOTO ARROW
  59. if errlevel 121 GOTO MAKEYES
  60. if errlevel 110 GOTO MAKENO
  61. if errlevel 89 GOTO MAKEYES
  62. if errlevel 78 GOTO MAKENO
  63. if errlevel 27 Let %!d = 0
  64. if errlevel 27 GOTO END
  65. if errlevel 13 GOTO ENTER
  66. if errlevel 9 GOTO ARROW
  67. goto CHOOSE
  68. :ARROW
  69. if %!p = y GOTO YES_NO
  70. if %!p = n GOTO NO_YES
  71. goto CHOOSE
  72. :YES_NO
  73. GOSUB NO
  74. let %!p = n
  75. goto CHOOSE
  76. :NO_YES
  77. GOSUB YES
  78. let %!p = y
  79. goto CHOOSE
  80. :ENTER
  81. if %!p = y GOTO MAKEYES
  82. if %!p = n GOTO MAKENO
  83. :MAKEYES
  84. GOSUB YES
  85. Let %!d = 2
  86. GOTO END
  87. :MAKENO
  88. GOSUB NO
  89. Let %!d = 1
  90. GOTO END
  91. :SYNTAX
  92. echo.
  93. echo       SYNTAX---:  CHEKBOX [ROW(1-21)] [COLUMN(1-65)] [yes]/[no]
  94. echo       USAGE----:  Use in .BAT programs to interreact with users. Program-
  95. echo                   mer positions a yes/no check box at given row/column
  96. echo                   coordinates. An option is provided to preselect either
  97. echo                   yes or no. The default is CHEKBOX 10 30 yes.
  98. echo                   You can choose the defaults by using CHEKBOX 0 0 so long
  99. echo                   as they are not out of alignment. In other words, yes or
  100. echo                   no MUST be the third parameter, parameter two cannot ex-
  101. echo                   ceed 65, and parameter one must be less than 22. User
  102. echo                   has these keypresses to choose from left/right cursor,
  103. echo                   tab, shift tab, Enter, ESCape, Y, y, N, and n.
  104. echo.
  105. echo       EXAMPLE--:  CHECKBOX 17 30 no
  106. echo       EXAMPLE--:  CHEKBOX 5 0  {column 30 and yes is defaulted to}
  107. echo       EXAMPLE--:  CHEKBOX 0 0  {row 10, column 30 and yes is defaulted to}
  108. echo                   Only the yes/no can be omitted.
  109. echo.
  110. echo     Dependent upon user's response the DOS ERRORLEVEL is changed. The yes
  111. echo     choice is 2, No is 1, and ESCape is 0 {Ex:  IF ERRORLEVEL 2 GOTO YES}.
  112. echo.
  113. echo       Public Domain BATCOM program example, 1990, by Felix A. Rozewicz
  114. goto END
  115. :ERROR
  116. echo  Unable to verify validity of first 2 primary parameters.
  117. echo  Or, there is an error in typing yes/no parameter.
  118. beep
  119. echo.
  120. waitkey 2
  121. goto SYNTAX
  122. :END
  123. EXIT %!d
  124.